package org.fatmansoft.teach.entity.ViewEntity.DailyActivity;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.fatmansoft.teach.entity.ViewEntity.Student;

import javax.persistence.*;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import java.util.Date;

@Data
@AllArgsConstructor
@NoArgsConstructor
@Entity
@Table(name = "student_daily_activity",
        uniqueConstraints = {
                @UniqueConstraint(columnNames = {"id"})
        })
public class StudentDailyActivity {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer id;  //ID

    @NotBlank
    private String activityName;  //活动名称

    @ManyToOne
    @JoinColumn(name = "activity_type")
    private DailyActivityType dailyActivityType;  //活动类型(fk)

    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date activityDate;  //活动日期

    @Size(max = 500)
    private String activityDescription;  //活动描述

    @ManyToOne
    @JoinColumn(name = "s_id")
    private Student student;

}
